#include <iostream>
#include <string>
#include "conversionpolicytest.h"


CPPUNIT_TEST_SUITE_REGISTRATION (ConversionPoliciesTest);

void ConversionPoliciesTest::setUp(void)
{

}


void ConversionPoliciesTest::tearDown(void)
{

}

void ConversionPoliciesTest::testStringToStringPolicy(void)
{
	sp_policies::StringToStringPolicy policy;

	std::string data = "foo";

	std::string output = policy.Convert(data);

	CPPUNIT_ASSERT_EQUAL(0, data.compare(output));


}


void ConversionPoliciesTest::testStringToIntPolicy(void)
{
	sp_policies::StringToIntPolicy policy;

	std::string data = "42";

	int output = policy.Convert(data);

	CPPUNIT_ASSERT_EQUAL(output, 42);
}

void ConversionPoliciesTest::testStringToFloatPolicy(void)
{
	sp_policies::StringToFloatPolicy policy;

	std::string data = "3.14";

	float output = policy.Convert(data);

	CPPUNIT_ASSERT_EQUAL(output, 3.14f);
}

void ConversionPoliciesTest::testStringToDoublePolicy(void)
{
	sp_policies::StringToDoublePolicy policy;

	std::string data = "3.1415";

	double output = policy.Convert(data);

	CPPUNIT_ASSERT_EQUAL(output, 3.1415);
}

void ConversionPoliciesTest::testStringToBoolPolicyTrue(void)
{
	sp_policies::StringToBoolPolicy policy;

	std::string data = "true";

	bool output = policy.Convert(data);

	CPPUNIT_ASSERT(output);
}

void ConversionPoliciesTest::testStringToBoolPolicyFalse(void)
{
	sp_policies::StringToBoolPolicy policy;

	std::string data = "false";
	bool output = policy.Convert(data);

	CPPUNIT_ASSERT(!output);
}

